<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            background-color: red;
            margin: 100px auto;
        }
        .box-1 {
            /* 转换属性: 旋转(0deg) */
            /* 0 ~ 360 0 ~ -360*/
            transform: rotate(60deg);

            /* 旋转中心 (left right top bottom center)*/
            transform-origin: left bottom;
        }
    </style>
</head>
<body>
    <div class="box box-1"></div>

    <script>
        // 要求:
            // 让矩形一直旋转
        
        // 获取标签
        var box1 = document.querySelector(".box-1");
        // 定义角度
        var angle = 0;
        // 执行定时器函数
        var t = setInterval(function(){
            angle += 1;
            // 设置标签的角度
            box1.style["transform"]="rotate("+angle+"deg)";

        },30)

    </script>
</body>
</html>